package com.ssy.lingxi.member.merchant.repository;

import com.ssy.lingxi.member.merchant.entity.CountryAreaDO;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 国家区域Repository
 * @author 万宁
 * @version 2.0.0
 * @date 2020-08-21
 */
@Repository
public interface CountryAreaRepository extends JpaRepository<CountryAreaDO, Long>, JpaSpecificationExecutor<CountryAreaDO> {

    List<CountryAreaDO> findByParentCode(String parentCode, Sort sort);

    List<CountryAreaDO> findByCodeIn(List<String> codes);

    <T> List<T> findByLevel(Integer level, Sort sort, Class<T> tClass);

    <T> List<T> findByCodeIn(List<String> codes, Class<T> tClass);

    <T> List<T> findByParentCode(String parentCode, Sort sort, Class<T> tClass);
}
